package com.eastedu.client.file;

import com.eastedu.client.file.model.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * The interface File client.
 *
 * @author zhangzhishuai
 */
@FeignClient(name = "file-service", path = "/file-service")
public interface FileClient {
    /**
     * 获取文件签名
     *
     * @param request 签名请求
     * @return 签名信息 file signature response
     */
    @PostMapping(value = "/api/files/signatures?version=4.0")
    FileSignatureResponse postFileSignature(FileSignatureRequest request);

    /**
     * Get.
     *
     * @param fileId the file id
     * @return the file info response
     */
    @GetMapping("/api/files/{fileId}?version=3.0")
    FileInfoResponse get(@PathVariable("fileId") Long fileId);

    /**
     * List file by md 5 list.
     *
     * @param provider the provider
     * @param md5s     the md 5 s
     * @return the list
     */
    @PostMapping("/api/files/md5?version=3.0")
    List<FileInfoResponse> listFileByMd5(@RequestParam("provider") String provider, @RequestBody List<String> md5s);

    /**
     * Function archive file function response.
     *
     * @param provider the provider
     * @param request  the request
     * @return the file function response
     */
    @PostMapping("/api/files/function:archive?version=4.0")
    FileFunctionResponse functionArchive(@RequestParam("provider") String provider, @RequestBody FileArchiveRequest request);

    /**
     * 更新文件
     *
     * @param id      文件ID
     * @param request 签名请求
     * @return 签名信息 file update response
     */
    @PutMapping(value = "/api/files/{id}?version=3.0")
    FileUpdateResponse putFile(@PathVariable String id, FileUpdateRequest request);

    /**
     * Restore.
     *
     * @param request the request
     */
    @PostMapping("/api/files/function:restore?version=4.0")
    void restore(@RequestBody FileRestoreRequest request);
}
